<template>
  <n-card title="接口文档" :bordered="false">
    <iframe
      :src="swaggerUrl"
      width="100%"
      height="800px"
      frameborder="0"
      style="border: 1px solid #eee; border-radius: 4px;"
    ></iframe>
  </n-card>
</template>

<script lang="ts" setup>
import { NCard  } from 'naive-ui';
import {computed, onMounted} from "vue";

// 计算属性生成 Swagger URL
const swaggerUrl = computed(() => {
  const apiUrl = import.meta.env.VITE_GLOB_API_URL;
  if (!apiUrl) {
    console.error('VITE_GLOB_API_URL 未定义');
    return null;
  }
  return `${apiUrl}/swagger/index.html`;
});

// 设置页面标题
const setPageTitle = () => {
  document.title = '接口文档 - 开放能力';
};

onMounted(() => {
  setPageTitle();
});
</script>
